<template>
  <div id="app">
    <nav-box></nav-box>
    <div class="login-time-out" v-if="tokenStatus">
      登录过期，请重新<span @click="login">登录</span>
      <em @click="close">x</em>
    </div>
    <div class="main auto">
      <router-view></router-view>
    </div>
    <footer-box v-show="footerStatus"></footer-box>
  </div>
</template>

<script>
  import navBox from './components/nav.vue'
  import footerBox from './components/footer.vue'
  export default {
    name: 'app',
    components: {
      navBox,
      footerBox
    },
    computed: {
      footerStatus () {
        return this.$store.state.user.footerStatus
      },
      tokenStatus () {
        return this.$store.state.user.tokenStatus
      }
    },
    methods: {
      login () {
        this.$logPop(true).then((response) => {
          if (response.code === '200') {
            this.$store.commit('user/updataTokenStatus', false)
          }
        })
      },
      close () {
        this.$store.commit('user/updataTokenStatus', false)
      }
    }
  }
</script>
<style src="./assets/scss/base.scss" lang="scss"></style>
